package com.wyiot.pet.model.dto;

import com.wyiot.core.enums.UserTypeEnum;
import com.wyiot.core.api.ValidateGroup;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * 用户注册或修改用户数据传输对象
 *
 * @author Laiqm
 * @since 2022/3/24
 */
@Data
public class UserDTO {
    @NotNull(message = "请传入id", groups = { ValidateGroup.First.class})
    private Long userId;

    /**
     * 用户账号
     */
    @NotBlank(message = "请输入账号", groups = {ValidateGroup.First.class, ValidateGroup.Second.class})
    private String userCode;
    /**

     * 用户密码
     */
    @NotBlank(message = "请输入密码", groups = {ValidateGroup.First.class, ValidateGroup.Second.class})
    private String userPassword;

    /**
     * 用户类型（个人、宠物店、犬舍、猫舍、其他）
     */
    private UserTypeEnum userType;

    /**
     * 真实姓名
     */
    private String userName;

    /**
     * 手机号
     */
    @NotBlank(message = "请输入联系电话", groups = {ValidateGroup.First.class, ValidateGroup.Second.class,ValidateGroup.Third.class})
    @Pattern(regexp = "^(?:(?:\\+|00)86)?1(?:(?:3[\\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\\d])|(?:9[189]))\\d{8}$",
            message = "请输入正确的手机号", groups = {ValidateGroup.First.class, ValidateGroup.Second.class,ValidateGroup.Third.class})
    private String userPhone;

}
